package model

// 设备状态变化通知消息：上下线
//{"action":"sysmsg","deviceid":"10014ae560","apikey":"886540f6-c21c-41f6-a9d9-95c7097890d7","params":{"online":false}}
//{"action":"sysmsg","deviceid":"10014ae560","apikey":"732099de-f647-4fb5-87bd-9415669d4305","params":{"online":true}}
type NotifyDeviceOnline struct {
	// 固定参数: sysmsg
	Action string `json:"action"`

	// 用户 apikey（可从登陆页面获取）
	Apikey string `json:"apikey"`

	// 8 位字母数字随机数
	Nonce string `json:"nonce"`

	// 时间戳精确到秒，
	Ts int64 `json:"ts"`

	// 设备 ID
	Deviceid string `json:"deviceid"`

	// 参数: {k:v}
	Params OnlineState `json:"params"`
}

// 设备在线状态
type OnlineState struct {
	Online bool `json:"online"`
}

// 设备状态改变
/**
{"action":"update","deviceid":"10014ae560","apikey":"886540f6-c21c-41f6-a9d9-95c7097890d7","userAgent":"app","sequence":"1647604006227","params":{"switches":[{"switch":"on","outlet":0},{"switch":"off","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]},"tempRec":"10014ae560"}
{"action":"update","deviceid":"10014ae560","apikey":"886540f6-c21c-41f6-a9d9-95c7097890d7","userAgent":"device","d_seq":29476,"params":{"switches":[{"switch":"on","outlet":0},{"switch":"off","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]},"from":"device"}
{"action":"update","deviceid":"10014ae560","apikey":"886540f6-c21c-41f6-a9d9-95c7097890d7","userAgent":"app","sequence":"1647604017360","params":{"switches":[{"switch":"on","outlet":0},{"switch":"on","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]},"tempRec":"10014ae560"}
{"action":"update","deviceid":"10014ae560","apikey":"886540f6-c21c-41f6-a9d9-95c7097890d7","userAgent":"device","d_seq":12245,"params":{"switches":[{"switch":"on","outlet":0},{"switch":"on","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]},"from":"device"}
{"action":"update","deviceid":"10014ae560","apikey":"886540f6-c21c-41f6-a9d9-95c7097890d7","userAgent":"app","sequence":"1647604019005","params":{"switches":[{"switch":"on","outlet":0},{"switch":"off","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]},"tempRec":"10014ae560"}
{"action":"update","deviceid":"10014ae560","apikey":"886540f6-c21c-41f6-a9d9-95c7097890d7","userAgent":"device","d_seq":8244,"params":{"switches":[{"switch":"on","outlet":0},{"switch":"off","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]},"from":"device"}
{"action":"update","deviceid":"10014ae560","apikey":"886540f6-c21c-41f6-a9d9-95c7097890d7","userAgent":"device","d_seq":503,"params":{"switches":[{"switch":"off","outlet":0},{"switch":"off","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]},"from":"device"}
**/
type NotifyOutlet4Update struct {
	// 固定参数: update
	Action string `json:"action"`

	// 设备 ID
	Deviceid string `json:"deviceid"`

	// 用户 apikey（可从登陆页面获取）
	Apikey string `json:"apikey"`

	// app 或者 device,,表示消息是哪边推送的，app表示是app向设备下发指令,device表示设备变化之后的响应
	UserAgent string `json:"userAgent"`

	// 时间戳精确到毫秒
	Sequence int64 `json:"sequence,string"`

	// 服务端对于 params 参数采用透传方式，可能是对象也可能是对象数组。
	Params Outlet4Switch `json:"params"`
}
